package com.penglei.share.config;

import com.penglei.share.interceptor.LoginIntercepter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.HiddenHttpMethodFilter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author ascetic
 * @version 1.0
 * @ClassName WebConfigurer
 * @Description TODO
 * @date 2020-06-09 01:17
 */

@Configuration
public class WebConfigurer implements WebMvcConfigurer {

    @Autowired
    LoginIntercepter loginIntercepter;




    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // addPathPatterns("/**") 表示拦截所有的请求，
        // excludePathPatterns("/login", "/register") 表示除了登陆与注册之外，因为登陆注册不需要登陆也可以访问
        registry.addInterceptor(loginIntercepter).addPathPatterns("/**").excludePathPatterns("/login", "/register");
    }

}